home *** CD-ROM | disk | FTP | other *** search
/ Visual Cafe 3 / Visual Cafe 3.ISO / Vcafe / Main.bin / alloc_cache.h < prev    next >
C/C++ Source or Header  |  1998-09-15  |  1KB  |  54 lines

  1. /*
  2.  * @(#)alloc_cache.h    1.5 98/07/01
  3.  *
  4.  * Copyright 1997, 1998 by Sun Microsystems, Inc.,
  5.  * 901 San Antonio Road, Palo Alto, California, 94303, U.S.A.
  6.  * All rights reserved.
  7.  * 
  8.  * This software is the confidential and proprietary information
  9.  * of Sun Microsystems, Inc. ("Confidential Information").  You
  10.  * shall not disclose such Confidential Information and shall use
  11.  * it only in accordance with the terms of the license agreement
  12.  * you entered into with Sun.
  13.  */
  14.  
  15. /*
  16.  * Per-thread allocation cache
  17.  */
  18.  
  19. #ifndef    _ALLOC_CACHE_H_
  20. #define    _ALLOC_CACHE_H_
  21.  
  22. /* Default cache (refill) size */
  23. #define    ALLOC_CACHE_SIZE    1024
  24. /* Default maximum local allocation size, must be less than cache size */
  25. #define    ALLOC_LOCAL_SIZE    (ALLOC_CACHE_SIZE/4)
  26. /* Default handle cache refill count */
  27. #define    ALLOC_HANDLE_COUNT    (ALLOC_CACHE_SIZE/8/3)
  28.  
  29. /*
  30.  * Per-thread structure
  31.  */
  32. struct alloc_cache {
  33.     volatile char    cache_busy;
  34.     char    cache_pad[3];
  35.     long    cache_size;
  36.     void    *cache_tail;
  37.     void    *cache_handles;
  38. };
  39.  
  40. /* Cache (refill) size */
  41. extern long allocCacheSize;
  42.  
  43. /* Allocations smaller than this are attempted from local cache.  Use
  44.    0 to turn off local allocation.  Must be less than cache size. */
  45. extern long allocLocalSize;
  46.  
  47. /* Cache handle refill count */
  48. extern long allocHandleCount;
  49.  
  50. /* Callback when thread exits */
  51. extern void allocCacheCleanup(struct alloc_cache *);
  52.  
  53. #endif /* _ALLOC_CACHE_H */
  54.